<template>
    <div class="hngkContent">
        <BigTitle />
        <component :is="$store.state.jcyjComponent"></component>
        <SideMenu />
    </div>
</template>

<script>
import Ks from './Ks'
import Hy from './Hy'
import BigTitle from './jcyjParts/BigTitle'
import SideMenu from './jcyjParts/JcyjSideMenu'
import {defineComponent,ref,onMounted,onBeforeUnmount} from 'vue'
import { useStore } from 'vuex'
import axios from 'axios'
export default defineComponent({
    components:{
        Ks,
        Hy,
        BigTitle,
        SideMenu
    },
    setup(){
        const store = useStore();
        onBeforeUnmount(()=>{
            store.commit("changeJcyjComponent",'Hy')
            layerManager.removeAll();
        })
        onMounted(()=>{
            store.commit("changeJcyjComponent",'Hy')
            // axios.interceptors.request.use(
            //   config => {
            //       console.log(config);
            //       if (localStorage.getItem("token")) {
            //           config.headers.Authorization = localStorage.getItem("token");//把localStorage的token放在Authorization里
            //       }
            //       return config;
            //   },
            //   function(err) {
            //       console.log("失败信息" + err);
            //   }
            // );
            // function aesMinEncrypt(word){
            //     var _word = CryptoJS.enc.Utf8.parse(word),
            //         _key = CryptoJS.enc.Utf8.parse("ihaierForTodoKey"),
            //         _iv = CryptoJS.enc.Utf8.parse("ihaierForTodo_Iv");
            //     var encrypted = CryptoJS.AES.encrypt(_word, _key, {
            //                 iv: _iv,
            //                 mode: CryptoJS.mode.CBC,
            //                 padding: CryptoJS.pad.Pkcs7
            //         });
            //     return encrypted.toString();
            // }
            // console.log(aesMinEncrypt("HaiNan6661"))
            // let password = aesMinEncrypt("HaiNan6661")
            // let data = { "username":"ShengT", "password":password}
            // axios.post(`http://218.77.183.123:8091/hnemap/api//dove-em/v1/ent/login`,data).then(res=>{
            //     //console.log('accessToken=>',res.data.data.accessToken);   
            //     let token=res.data.data.accessToken;
            //     localStorage.setItem("token", token);  
            //     axios.get('http://218.77.183.123:8091/hnemap/api//dove-statistics/v1/statistics/large/screen/early/getWarningSituationTrendAnalysis').then((res)=>{
            //         console.log(res.data)
            //     })
            // })
        })
        return {
            
        }
    }
})
</script>

<style lang="stylus" scoped>
    
</style>